---
title: AppleProvider
editUrl: https://github.com/toolbeam/openauth/blob/master/packages/openauth/src/provider/apple.ts
description: Reference doc for the `AppleProvider`.
---

import { Segment, Section, NestedTitle, InlineSection } from 'toolbeam-docs-theme/components'
import { Tabs, TabItem } from '@astrojs/starlight/components'

<div class="tsdoc">
<Section type="about">
Use this provider to authenticate with Apple. Supports both OAuth2 and OIDC.

#### Using OAuth

```ts {5-8}
import { AppleProvider } from "@openauthjs/openauth/provider/apple"

export default issuer({
  providers: {
    apple: AppleProvider({
      clientID: "1234567890",
      clientSecret: "0987654321"
    })
  }
})
```

#### Using OIDC

```ts {5-7}
import { AppleOidcProvider } from "@openauthjs/openauth/provider/apple"

export default issuer({
  providers: {
    apple: AppleOidcProvider({
      clientID: "1234567890"
    })
  }
})
```
</Section>
---
## Methods
### AppleOidcProvider
<Segment>
<Section type="signature">
```ts
AppleOidcProvider(config)
```
</Section>
<Section type="parameters">
#### Parameters
- <p><code class="key">config</code> [<code class="type">AppleOidcConfig</code>](/docs/provider/apple#appleoidcconfig)</p>
The config for the provider.
</Section>
<InlineSection>
**Returns** <code class="type">Provider</code>
</InlineSection>
Create an Apple OIDC provider.

This is useful if you just want to verify the user's email address.
```ts
AppleOidcProvider({
  clientID: "1234567890"
})
```
</Segment>
### AppleProvider
<Segment>
<Section type="signature">
```ts
AppleProvider(config)
```
</Section>
<Section type="parameters">
#### Parameters
- <p><code class="key">config</code> [<code class="type">AppleConfig</code>](/docs/provider/apple#appleconfig)</p>
The config for the provider.
</Section>
<InlineSection>
**Returns** <code class="type">Provider</code>
</InlineSection>
Create an Apple OAuth2 provider.
```ts
AppleProvider({
  clientID: "1234567890",
  clientSecret: "0987654321"
})
```
</Segment>
## AppleConfig
<Segment>
<Section type="parameters">
- <p>[<code class="key">clientID</code>](#appleconfig.clientid) <code class="primitive">string</code></p>
- <p>[<code class="key">clientSecret</code>](#appleconfig.clientsecret) <code class="primitive">string</code></p>
- <p>[<code class="key">pkce?</code>](#appleconfig.pkce) <code class="primitive">boolean</code></p>
- <p>[<code class="key">query?</code>](#appleconfig.query) <code class="primitive">Record</code><code class="symbol">&lt;</code><code class="primitive">string</code>, <code class="primitive">string</code><code class="symbol">&gt;</code></p>
- <p>[<code class="key">scopes</code>](#appleconfig.scopes) <code class="primitive">string</code><code class="symbol">[]</code></p>
</Section>
</Segment>
<NestedTitle id="appleconfig.clientid" Tag="h4" parent="AppleConfig.">clientID</NestedTitle>
<Segment>
<Section type="parameters">
<InlineSection>
**Type** <code class="primitive">string</code>
</InlineSection>
</Section>
The client ID.

This is just a string to identify your app.
```ts
{
  clientID: "my-client"
}
```
</Segment>
<NestedTitle id="appleconfig.clientsecret" Tag="h4" parent="AppleConfig.">clientSecret</NestedTitle>
<Segment>
<Section type="parameters">
<InlineSection>
**Type** <code class="primitive">string</code>
</InlineSection>
</Section>
The client secret.

This is a private key that's used to authenticate your app. It should be kept secret.
```ts
{
  clientSecret: "0987654321"
}
```
</Segment>
<NestedTitle id="appleconfig.pkce" Tag="h4" parent="AppleConfig.">pkce?</NestedTitle>
<Segment>
<Section type="parameters">
<InlineSection>
**Type** <code class="primitive">boolean</code>
</InlineSection>
</Section>

<InlineSection>
**Default** false
</InlineSection>
Whether to use PKCE (Proof Key for Code Exchange) for the authorization code flow.
Some providers like x.com require this.
</Segment>
<NestedTitle id="appleconfig.query" Tag="h4" parent="AppleConfig.">query?</NestedTitle>
<Segment>
<Section type="parameters">
<InlineSection>
**Type** <code class="primitive">Record</code><code class="symbol">&lt;</code><code class="primitive">string</code>, <code class="primitive">string</code><code class="symbol">&gt;</code>
</InlineSection>
</Section>
Any additional parameters that you want to pass to the authorization endpoint.
```ts
{
  query: {
    access_type: "offline",
    prompt: "consent"
  }
}
```
</Segment>
<NestedTitle id="appleconfig.scopes" Tag="h4" parent="AppleConfig.">scopes</NestedTitle>
<Segment>
<Section type="parameters">
<InlineSection>
**Type** <code class="primitive">string</code><code class="symbol">[]</code>
</InlineSection>
</Section>
A list of OAuth scopes that you want to request.
```ts
{
  scopes: ["email", "profile"]
}
```
</Segment>
## AppleOidcConfig
<Segment>
<Section type="parameters">
- <p>[<code class="key">clientID</code>](#appleoidcconfig.clientid) <code class="primitive">string</code></p>
- <p>[<code class="key">query?</code>](#appleoidcconfig.query) <code class="primitive">Record</code><code class="symbol">&lt;</code><code class="primitive">string</code>, <code class="primitive">string</code><code class="symbol">&gt;</code></p>
- <p>[<code class="key">scopes?</code>](#appleoidcconfig.scopes) <code class="primitive">string</code><code class="symbol">[]</code></p>
</Section>
</Segment>
<NestedTitle id="appleoidcconfig.clientid" Tag="h4" parent="AppleOidcConfig.">clientID</NestedTitle>
<Segment>
<Section type="parameters">
<InlineSection>
**Type** <code class="primitive">string</code>
</InlineSection>
</Section>
The client ID.

This is just a string to identify your app.
```ts
{
  clientID: "my-client"
}
```
</Segment>
<NestedTitle id="appleoidcconfig.query" Tag="h4" parent="AppleOidcConfig.">query?</NestedTitle>
<Segment>
<Section type="parameters">
<InlineSection>
**Type** <code class="primitive">Record</code><code class="symbol">&lt;</code><code class="primitive">string</code>, <code class="primitive">string</code><code class="symbol">&gt;</code>
</InlineSection>
</Section>
Any additional parameters that you want to pass to the authorization endpoint.
```ts
{
  query: {
    prompt: "consent"
  }
}
```
</Segment>
<NestedTitle id="appleoidcconfig.scopes" Tag="h4" parent="AppleOidcConfig.">scopes?</NestedTitle>
<Segment>
<Section type="parameters">
<InlineSection>
**Type** <code class="primitive">string</code><code class="symbol">[]</code>
</InlineSection>
</Section>
A list of OIDC scopes that you want to request.
```ts
{
  scopes: ["openid", "profile", "email"]
}
```
</Segment>
</div>